<template>
  <div class="app">
    <div class="nav">
      <Event />
      <router-link to="/">首页</router-link>
      <br>
      <router-link to="/about">关于</router-link>
      <div v-for="nav in navData" :key="nav.id">
        <router-link :to="nav.path">{{ nav.title }}</router-link>
      </div>
    </div>
    <div class="content">
      <router-view></router-view>
    </div>
  </div>
</template>
  
<script>
import { ref } from 'vue'; // 引入 ref

// 导入导航数据
import { navData } from '@/untils/nav'

export default {
  name: 'App',
  components: {
    
  },
  setup() {
    // 将 navData 转换为响应式数据
    const navDataRef = ref(navData);

    // 返回导航数据的响应式引用
    return {
      navData: navDataRef
    };
  }
};
</script>
  
<style>
.app {
  display: flex;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  height: 100vh; /* 使应用程序占满整个视口高度 */
}

.nav {
  width: 200px;
  background: #f8f9fa;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.nav a {
  display: block;
  color: #2c3e50;
  padding: 10px 0;
  text-decoration: none;
  font-weight: bold;
}

.nav a:hover {
  background: #e9ecef;
}

.content {
  flex: 1;
  padding: 20px;
  overflow: auto; 
}
</style>
